home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / gcc / ixemlsrc.lha / ixemul / general / psignal.c < prev    next >
C/C++ Source or Header  |  1996-03-13  |  2KB  |  52 lines

  1. /*
  2.  * Copyright (c) 1983 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that: (1) source distributions retain this entire copyright
  7.  * notice and comment, and (2) distributions including binaries display
  8.  * the following acknowledgement:  ``This product includes software
  9.  * developed by the University of California, Berkeley and its contributors''
  10.  * in the documentation or other materials provided with the distribution
  11.  * and in all advertising materials mentioning features or use of this
  12.  * software. Neither the name of the University nor the names of its
  13.  * contributors may be used to endorse or promote products derived
  14.  * from this software without specific prior written permission.
  15.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  16.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  17.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  18.  */
  19.  
  20. #if defined(LIBC_SCCS) && !defined(lint)
  21. static char sccsid[] = "@(#)psignal.c    5.4 (Berkeley) 6/1/90";
  22. #endif /* LIBC_SCCS and not lint */
  23.  
  24. #define KERNEL
  25. #include "ixemul.h"
  26.  
  27. /*
  28.  * Print the name of the signal indicated
  29.  * along with the supplied message.
  30.  */
  31.  
  32. extern    char *sys_siglist[];    /* this one is library-internal! */
  33.  
  34. void
  35. psignal(u_int sig, const char *s)
  36. {
  37.     register char *c;
  38.     register int n;
  39.  
  40.     if (sig < NSIG)
  41.         c = sys_siglist[sig];
  42.     else
  43.         c = "Unknown signal";
  44.     n = strlen(s);
  45.     if (n) {
  46.         (void) syscall (SYS_write, 2, s, n);
  47.         (void) syscall (SYS_write, 2, ": ", 2);
  48.     }
  49.     (void) syscall (SYS_write, 2, c, strlen(c));
  50.     (void) syscall (SYS_write, 2, "\n", 1);
  51. }
  52.